package po;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "IOS_ORDERS")
public class Orders implements Serializable {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	private String oId;
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = Merchant.class)
	@JoinColumn(name = "mid", nullable = false)
	private Merchant merchant;
	@ManyToOne(fetch = FetchType.EAGER, targetEntity = Client.class)
	@JoinColumn(name = "cid", nullable = false)
	private Client client;
	private Date dt;
	@OneToMany(cascade ={CascadeType.REMOVE, CascadeType.PERSIST}, fetch = FetchType.EAGER, mappedBy = "order")
	List<OrderItems> orderItems = new ArrayList<OrderItems>();
	private int ograde;
	private int status;
	private int receive;
	private String complain;
	public Orders() {
		super();
	}
	public Orders(String oId, Merchant merchant, Client client, Date dt, List<OrderItems> orderItems, int ograde,
			int status, int receive, String complain) {
		super();
		this.oId = oId;
		this.merchant = merchant;
		this.client = client;
		this.dt = dt;
		this.orderItems = orderItems;
		this.ograde = ograde;
		this.status = status;
		this.receive = receive;
		this.complain = complain;
	}
	public String getoId() {
		return oId;
	}
	public void setoId(String oId) {
		this.oId = oId;
	}
	public Merchant getMerchant() {
		return merchant;
	}
	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}
	public Client getClient() {
		return client;
	}
	public void setClient(Client client) {
		this.client = client;
	}
	public Date getDt() {
		return dt;
	}
	public void setDt(Date dt) {
		this.dt = dt;
	}
	public List<OrderItems> getOrderItems() {
		return orderItems;
	}
	public void setOrderItems(List<OrderItems> orderItems) {
		this.orderItems = orderItems;
	}
	public int getOgrade() {
		return ograde;
	}
	public void setOgrade(int ograde) {
		this.ograde = ograde;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public int getReceive() {
		return receive;
	}
	public void setReceive(int receive) {
		this.receive = receive;
	}
	public String getComplain() {
		return complain;
	}
	public void setComplain(String complain) {
		this.complain = complain;
	}
	

}
